package net.wanho.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.io.File;

/**
 * Author：汤小洋
 * Date：2025-06-30 16:27
 * Description：<描述>
 */
@Configuration
public class ResourcesConfig implements WebMvcConfigurer {

    @Value("${file.path}")
    private String localFilePath;

    @Value("${file.prefix}")
    private String localFilePrefix;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler(localFilePrefix + "/**")
                .addResourceLocations("file:" + localFilePath + File.separator);

    }
}
